Repository navigation
Fix database upgrade when the debug column is missing - #356
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the database upgrade fix.
No open issues 🎉
What changed in this PR
Fixes Weathermap’s database upgrade when weathermap_maps.debug is missing, preserving the column’s existing values and default.
Changes:
- Removes the duplicated column name from the upgrade SQL.
- Adds a regression test for the missing-column statement.
- Records the fix in the 2.1 changelog.
| File | Description |
|---|---|
| tests/Unit/WeathermapUpgradeTest.php | Verifies the upgrade emits the corrected SQL statement. |
| includes/database.php | Corrects the ALTER TABLE statement for the missing debug column. |
| CHANGELOG.md | Documents the database upgrade fix. |
Review effort: Balanced
somethingwithproof
left a comment
There was a problem hiding this comment.
The corrected ALTER statement is valid, and all three upgrade tests pass locally. I also verified the SQL against MariaDB 11.8, including preservation of existing map rows. However, the complete upgrade path does not repair an installation that has already encountered the malformed statement: the earlier run stamps version 2.1 despite the failure, so applying this PR skips the corrected migration. Please cover that recovery state before merging.
|



Upgrading an installation without
weathermap_maps.debugcurrently runsADD COLUMN debugdebugset(...). The duplicated name is interpreted as a data type, so the column is not added. I hit this during a live upgrade to develop; applying the corrected ALTER statement added the column successfully.Remove the duplicated name, keeping the existing values and default. Also repairs installations already stamped as 2.1 by the failed upgrade. That recovery checks only the missing debug column, without rerunning unrelated migrations, and retries on a later call if the column is still absent. Includes regression coverage and a 2.1 changelog entry.
Validation:
The test checks the SQL emitted by the upgrade using the existing database stubs; the corrected statement was also applied successfully on the live MariaDB installation. The full Pest suite is left to CI.